package com.cute4j.diffs.cuteswing;

import com.cute4j.swing.Button;
import com.cute4j.swing.Menu;
import com.cute4j.swing.MenuBar;
import com.cute4j.swing.MenuItem;
import com.cute4j.swing.events.ActionEvent;
import com.cute4j.swing.events.ActionListener;
import com.cute4j.swingx.MainFrame;

/**
 * Generic Application.
 */
public class GenericApplication {

  public static void main(String[] args) {
    MainFrame frame = new MainFrame("Generic Application"); // <-- DIFF
    MenuBar menuBar = frame.setMenuBar(new MenuBar()); // <-- DIFF+
    Menu fileMenu = menuBar.add(new Menu("File")); // <-- DIFF+
    MenuItem exitMenuItem = fileMenu.add(new MenuItem("Exit")); // <-- DIFF+
    Button button = new Button("Close");
    frame.add(button); // <-- DIFF+
    ActionListener closeListener = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        System.exit(0);
      }
    };
    button.addActionListener(closeListener);
    exitMenuItem.addActionListener(closeListener);
    frame.pack();
    frame.show(); // <-- DIFF: blocking
  }

}
